/**
 * Project: d20Campaigner
 * Created: Aug 13, 2007 by bebopJMM
 */
package org.rollinitiative.d20.combat;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rollinitiative.d20.combat.actions.standard.Attack;
import org.rollinitiative.d20.encounter.Encounter;
import org.rollinitiative.d20.entity.Actor;
import org.rollinitiative.d20tools.arena.Arena;

/**
 * @author bebopJMM
 * 
 */
public class TurnProcessor
{
    static final Log LOG_ = LogFactory.getLog(TurnProcessor.class);

    Encounter encounter_;


    public void setEncounter(Encounter encounter)
    {
        this.encounter_ = encounter;
    }


    public void process(Combatant combatant)
    {
        LOG_.info("Processing actionSet");

        // Need to populate action set...
        ActionSet actionSet = combatant.getActionSet();

        // Get action set
        // Calculate action
        // Execute action

        // Action[] = { new Attack(), new TotalDefense(), new Move()...
        // For now... choose FIGHT! :)
        Actor defender = null;

//        if (arena.getPartyList().contains(combatant.getActor())) {
//            // defender = getStrongestHostileDefender(attacker);
//            defender = arena.getWeakestHostileDefender(combatant.getActor());
//            // defender = getHostileDefender();
//        }
//        else
//            defender = arena.getPartyDefender();
        Action action = new Attack(combatant);
        action.execute();
    }


    public void process(ActionSet actionSet)
    {
        LOG_.info("Processing actionSet");
    }
}
